<template>
  <div class="rose-echart">
    <xjh-echart :options="(options as EChartsOption)"></xjh-echart>
  </div>
</template>

<script lang="ts" setup>
import { computed, defineProps, withDefaults } from 'vue';
import { EChartsOption } from 'echarts';

import xjhEchart from '@/base-ui/echart';
import { IPieEchartDataType } from '../types';

const props = withDefaults(defineProps<{ data: IPieEchartDataType }>(), {});

const options = computed(() => {
  return {
    title: {
      text: '',
      subtext: '',
      left: 'center'
    },
    tooltip: {
      trigger: 'item'
    },
    legend: {
      // orient: 'vertical',
      left: 'left'
    },
    series: [
      {
        name: '分类商品数量',
        type: 'pie',
        radius: '50%',
        data: props.data,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  };
});
</script>

<style lang="less" scoped>
.rose-echart {
  color: #fff;
}
</style>
